#Last modified: 12/14/2018

rm(list=ls())
setwd("XXX/Domestic Violence")
install.packages("rdd")
library(rdd)
library(foreign)

mydata <- read.dta("women_data_for_analysis_2014.dta")
sample <- mydata[which(mydata$dif>=-80 & mydata$dif<=80),]

par(mfrow=c(1,1), cex=1, lab=c(1,5,1))

den<-DCdensity(sample$dif, bin=1, bw=80, ext.out=TRUE)
axis(1, at=seq(-80,80,40), las=1)

##Adding titles and vertical line at cutoff point (dif=0)
title(xlab='Born After January 1987 (In Months)', ylab='Density')
abline(v=0, lwd=2, lty=2)